{smcl}
{txt}{sf}{ul off}{.-}
      name:  {res}<unnamed>
       {txt}log:  {res}R:\WSV2\TBu_AKe\Spatial_NEW\spatial_5_transform_s_2703.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res}28 Mar 2023, 18:09:00
{txt}
{com}. 
. use "R:\WSV2\TBu_AKe\Spatial_NEW\spatial_2_collapse_mc.dta" 
{txt}
{com}. 
. 
. drop if ccode == 0 // from collapse structure   
{txt}(900,900 observations deleted)

{com}. 
. sort cell 
{txt}
{com}. 
. gsort -bunching +cell 
{txt}
{com}. gen bcell = _n if bunching == 1 // identify B
{txt}(6,242,600 missing values generated)

{com}. 
. gsort -restricted +cell 
{txt}
{com}. gen rcell = _n if restricted == 1 // identify R
{txt}(2,675,400 missing values generated)

{com}. 
. egen xc = group(ccode cell) //  
{res}{txt}
{com}. egen kt = group(ccode date) // 
{res}{txt}(485,100 missing values generated)

{com}. 
. 
. ******************************
. *** prepare for regression *** 
. ******************************
. 
. ** run up min-req-curve and find neighbors for each point 
.                 * i : 50 cells in bunching region, cells 1-50 in data 
.                 * j : restricted cells, 50 upwards 
. 
. rename cell_date_sales csd // simplify notation 
{res}{txt}
{com}. label variable csd "cell_date_sales"
{txt}
{com}. rename cell_date_count ccd      
{res}{txt}
{com}. label variable ccd "cell_date_count"
{txt}
{com}. 
. 
. sort cell 
{txt}
{com}. xtset cell kt // crucial.  
{res}
{col 1}{txt:Panel variable: }{res:cell}{txt: (unbalanced)}
{p 1 16 2}{txt:Time variable: }{res:kt}{txt:, }{res:{bind:1}}{txt: to }{res:{bind:1176}}{p_end}
{txt}{col 10}Delta: {res}1 unit
{txt}
{com}. 
. gen log_sd = ln(csd)
{txt}(6,238,624 missing values generated)

{com}. gen log_cd = ln(ccd)
{txt}(6,215,021 missing values generated)

{com}.         
. foreach i of numlist 12 24 36 48 60 {c -(}
{txt}  2{com}.         local k = `i'/12
{txt}  3{com}.         generate S`k'_lsd = S`i'.log_sd // takes S, bc D operator compounds. 
{txt}  4{com}.         generate S`k'_lcd = S`i'.log_cd
{txt}  5{com}.         generate L`k'_lsd = L`i'.log_sd // takes S, bc D operator compounds. 
{txt}  6{com}.         generate L`k'_lcd = L`i'.log_cd
{txt}  7{com}. {c )-}
{txt}(6,257,359 missing values generated)
(6,234,821 missing values generated)
(6,238,752 missing values generated)
(6,215,176 missing values generated)
(6,270,020 missing values generated)
(6,250,797 missing values generated)
(6,239,538 missing values generated)
(6,216,304 missing values generated)
(6,280,160 missing values generated)
(6,264,704 missing values generated)
(6,240,346 missing values generated)
(6,217,575 missing values generated)
(6,288,212 missing values generated)
(6,275,946 missing values generated)
(6,241,189 missing values generated)
(6,218,965 missing values generated)
(6,293,728 missing values generated)
(6,284,588 missing values generated)
(6,242,089 missing values generated)
(6,220,329 missing values generated)

{com}. 
. foreach i of numlist  12 24 36 48 60 {c -(}
{txt}  2{com}.         local k = `i'/12
{txt}  3{com}.         generate S`k'_sd = S`i'.csd 
{txt}  4{com}.         generate S`k'_cd = S`i'.ccd
{txt}  5{com}.         generate L`k'_sd = L`i'.csd 
{txt}  6{com}.         generate L`k'_cd = L`i'.ccd
{txt}  7{com}. {c )-}
{txt}(64,350 missing values generated)
(64,350 missing values generated)
(64,350 missing values generated)
(64,350 missing values generated)
(123,750 missing values generated)
(123,750 missing values generated)
(123,750 missing values generated)
(123,750 missing values generated)
(183,150 missing values generated)
(183,150 missing values generated)
(183,150 missing values generated)
(183,150 missing values generated)
(242,550 missing values generated)
(242,550 missing values generated)
(242,550 missing values generated)
(242,550 missing values generated)
(301,950 missing values generated)
(301,950 missing values generated)
(301,950 missing values generated)
(301,950 missing values generated)

{com}.         
. cd "$store"
{res}R:\WSV2\TBu_AKe\Spatial_NEW\Data
{txt}
{com}. save spatial_6_regs_s_monthly, replace // data set used for estimation 
{txt}{p 0 4 2}
(file {bf}
spatial_6_regs_s_monthly.dta{rm}
not found)
{p_end}
{p 0 4 2}
file {bf}
spatial_6_regs_s_monthly.dta{rm}
saved
{p_end}

{com}. 
. log close 
      {txt}name:  {res}<unnamed>
       {txt}log:  {res}R:\WSV2\TBu_AKe\Spatial_NEW\spatial_5_transform_s_2703.smcl
  {txt}log type:  {res}smcl
 {txt}closed on:  {res}28 Mar 2023, 18:16:14
{txt}{.-}
{smcl}
{txt}{sf}{ul off}